#ifndef __HTTPPARSE_H__
#define __HTTPPARSE_H__

#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "TcpIpHeader.h"

static int rawPacketCount = 0;
static int httpPacketCount = 0;
static int sessionID = 0;

struct HttpSession {
	int id;
	unsigned int ack; 
	char url[512];
	char method[8];
	char statucode[4];
	char contentType[16];
	char contentLength[8];
	char *sendRaw;
	char *responseRaw;
	time_t sendTime;
	time_t responseTime;
}httpSession[100000];

static int IsHttp(const struct TcpHeader *tcpHeader);
extern void PacketProcessing(const unsigned char *packet, unsigned int len);
static void HttpParse(const struct IpHeader *ipHeader, unsigned int ipLen);
static void BuildPacket(int isReq, unsigned int ack, unsigned int seq, const struct IpHeader *ipHeader, int start, int ipLength);
static int AddMethodAndURL(const char *data, char *method, char *url);
static int AddStatucode(const char *data, char *statucode);
static int AddContentTypeAndLength(const char *data, char *type, char *length);
static void PrintResult(int id);
static void IsSessionIDMax();
#endif
